package com.seanLab.service;

import com.seanLab.domain.Body;
import com.seanLab.domain.Image;
import com.seanLab.repository.ImageRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;

/**
 * Created by ailly on 17-8-28.
 */
@Service
public class ImageService {
//    @Autowired
//    @Qualifier("fakeImage")
//    private ImageDao imageDao;

    @Autowired
    private ImageRepo imageRepo;

    public Body insertImage(Image image) {
        //this.imageDao.insertImage(image);
        this.imageRepo.save(image);
        return Body.getResponseBody(0, image);
    }

    public Collection<Image> getAllImages() {
        return this.imageRepo.findAll();
        //return this.imageDao.getAllImages();

    }
}
